package com.hskn.hss.task;

import com.hskn.hss.module.tlequipmonitor.service.TlEquipMonitorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

@Slf4j
@Configuration
@EnableScheduling
public class MonitorTask {

    @Autowired
    private TlEquipMonitorService tlEquipMonitorService;

    @Value("${switch.timed_task}")
    private Boolean timed_task;

    /**
     * 设备监控任务
     */
//    @Scheduled(cron = "0 0/10 * * * ?")
    private void monitor() {
        if (!timed_task) {
            return;
        }
        try {
            tlEquipMonitorService.refresh();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
